package com.fqcar.fqdf.ui.main.runnable.noui;

import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.Overlay;
import com.fqcar.fqdf.entity.CarInfo;
import com.fqcar.fqdf.ui.chargemap.view.StubViewInterface;
import com.fqcar.fqdf.ui.main.marker.MainBaiduMarkerHelper;
import com.fqcar.fqdf.ui.main.runnable.BaiduRunnable;
import com.fqcar.fqdf.ui.main.view.MainViewInterface;

import java.util.List;

public class CarOverlayRunnable extends BaiduRunnable {

    private List<CarInfo> mData;

    private MyRunnableListener mListener;

    public CarOverlayRunnable(MainViewInterface mainView, BaiduMap baiduMap, List<CarInfo> data,
                              MainBaiduMarkerHelper helper, MyRunnableListener listener) {
        super(mainView, baiduMap, helper);
        mData = data;
        mListener =listener;
    }
    public CarOverlayRunnable(StubViewInterface stubView, BaiduMap baiduMap, List<CarInfo> data,
                              MainBaiduMarkerHelper helper, MyRunnableListener listener) {
        super(stubView, baiduMap, helper);
        mData = data;
        mListener =listener;
    }

    @Override
    public void run() {

        List<Overlay> carMarker = getMarkerHelper().createCarMarker(mData);
        if(mListener!=null){
            mListener.handleFinish(carMarker);
        }
    }
}
